﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Configuration;


/// <summary>
/// Getting configuration information from web.config file.
/// </summary>
public class WbGetParams
{
    public static string CompanyKeysFile
    {
        get 
        {
            string result = WebConfigurationManager.AppSettings.Get("CompanyKeysFile");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            return "Error!";
        }
    }

    public static string DFSHomesFile
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("DFSHomesFile");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            return "Error!";
        }
    }

    public static string ExchangeDatabaseNamesFile
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("ExchangeDatabaseNamesFile");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            return "Error!";
        }
    }

    public static string ExchangeMailboxRetentionFile
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("ExchangeMailboxRetentionFile");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            return "Error!";
        }
    }

    public static string ExchangeOwaPolicyFile
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("ExchangeOwaPolicyFile");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            return "Error!";
        }
    }

    public static string ADGroupNamesFile
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("ADGroupNamesFile");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            return "Error!";
        }
    }

    public static string UsageLogFile
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("UsageLogFile");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            return "Error!";
        }
    }    

    public static string ExchangeServerName
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("ExchangeServerName");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            return "Error!";
        }
    }

    public static string ExchangeSecondServerName
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("ExchangeSecondServerName");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            return "Error!";
        }
    } 
    
    public static string AppVersion
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("AppVersion");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            return "Error!";
        }
    }

    public static string NotifyFromAddress
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("NotifyFromAddress");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            throw new Exception("AppSetting NotifyFromAddress not found web.config file.");
        }
    }

    public static string NotifyFromName
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("NotifyFromName");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            throw new Exception("AppSetting NotifyFromName not found web.config file.");
        }
    }

    public static string NotifyToAddress
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("NotifyToAddress");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            throw new Exception("AppSetting NotifyToAddress not found web.config file.");
        }
    }

    public static string NotifyToName
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("NotifyToName");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            throw new Exception("AppSetting NotifyToName not found web.config file.");
        }
    }

    public static string NotifyExchangeServer
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("NotifyExchangeServer");
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }
            throw new Exception("AppSetting NotifyExchangeServer not found web.config file.");
        }
    }


    public static bool SendMailOnError
    {
        get
        {
            string result = WebConfigurationManager.AppSettings.Get("SendMailOnError");
            if (!string.IsNullOrEmpty(result))
            {
                return Convert.ToBoolean(result);
            }
            throw new Exception("AppSetting SendMailOnError not found in web.config file.");
        }
    }


}